<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>三窗口模板</title>
    <link href="../../../../resources/lib/bui/css/dpl-min.css"
          th:href="@{/resources/lib/bui/css/dpl-min.css}"
          rel="stylesheet" />
    <link href="../../../../resources/lib/bui/css/bui-min.css"
          th:href="@{/resources/lib/bui/css/bui-min.css}"
          rel="stylesheet" />
    <link href="../../../../resources/lib/bui/css/bui-min.css"
          th:href="@{/resources/lib/bui/css/layout-min.css}"
          rel="stylesheet" />
    <script src="../../../../resources/lib/bui/js/jquery-1.8.1.min.js"
            th:src="@{/resources/lib/bui/js/jquery-1.8.1.min.js}"></script>
    <script src="../../../../resources/lib/bui/js/bui-min.js"
            th:src="@{/resources/lib/bui/js/bui-min.js}"></script>
    <script src="../../../../resources/lib/jquery/jquery.form.min.js"
            th:src="@{/resources/lib/jquery/jquery.form.min.js}"></script>
    <script src="../../../../resources/lib/jquery/jquery.util.js"
            th:src="@{/resources/lib/jquery/jquery.util.js}"></script>
    <style type="text/css">
        a{color:#fff;font-size: 24px;}
        a:visited{text-decoration:none; color:red;}
        a:hover{text-decoration:none; color:red;}
    </style>
</head>
<body>
<div id="add" th:include="nh/template/addLinkDialog :: add" style="display: none;width:100%;height: 100%;"></div>
<div id="setting" th:include="nh/template/template_setting :: setting" style="display: none;width:100%;height: 100%;"></div>
<script type="text/javascript">
    var winWidth = 0;
    var winHeight = 0;
    var control3_1 = null;
    var control3_2 = null;
    var iframe1Height = 0;
    var iframe2Height = 0;
    findDimensions3();
    //函数：获取尺寸
    function findDimensions3(){
        //获取窗口宽度
        if (window.innerWidth)
            winWidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winWidth = document.body.clientWidth;
        //获取窗口高度
        if (window.innerHeight)
            winHeight = window.innerHeight;
        else if ((document.body) && (document.body.clientHeight))
            winHeight = document.body.clientHeight;
        //通过深入Document内部对body进行检测，获取窗口大小
        if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth)
        {
            winHeight = document.documentElement.clientHeight;
            winWidth = document.documentElement.clientWidth;
        }
        //winHeight-=20;
        //winWidth-=20;
        if(type=='show'){
            iframe1Height = winHeight/2;
            iframe2Height = winHeight/2;
        }else if(type=='set'){
            iframe1Height = winHeight*(0.85/2);
            iframe2Height = winHeight*(1.15/2);
        }
        initLayout();
    }
    //初始化布局
    function initLayout(){
        BUI.use(['bui/layout','bui/grid','bui/data','bui/tree'],function (Layout,Grid,Data,Tree) {
            control3_1 = new BUI.Component.Controller({
                width:winWidth,
                height:winHeight,
                //srcNode : '#one',
                elCls : 'ext-border-layout',
                children : [{
                    xclass : 'controller',
                    layout : {
                        title : '<a href="javascript:void(0)" onclick="showDialog(control3_1,\'c3_1\',1,nodeId)">+</a>&nbsp;&nbsp;<span id="title1"></span>',
                        region : 'west',
                        fit : 'height',
                        width : winWidth/4
                    },
                    id : 'c3_1',
                    content : ''
                },{
                    xclass : 'controller',
                    layout : {
                        title : '<a href="javascript:void(0)" onclick="showDialog(control3_1,\'c3_2\',2,nodeId)">+</a>&nbsp;&nbsp;<span id="title2"></span>',
                        region : 'center',
                        fit : 'height'
                    },
                    id : 'c3_2',
                    content : "<iframe id='iframe1' src='' height='"+iframe1Height+"'  width='"+winWidth*3/4+"'></iframe><br>" +
                            '<div class="x-border-title x-border-title-center"><a href="javascript:void(0)" onclick="showDialog(control3_1,\'c3_3\',3,nodeId)">+</a>&nbsp;&nbsp;<span id="title3"></span></div>' +
                            "<iframe id='iframe2' src='' height='"+iframe2Height+"'  width='"+winWidth*3/4+"'></iframe>"
                }],
               plugins : [Layout.Border]
            }).render();
            findInitInfor(nodeId);
        });
    }
    function choseTemplate(modelCount) {
        if(treeMenu!=null) {
            if(treeMenu.title1!=null&&treeMenu.title1!=""){
                $('#title1').html(treeMenu.title1);
            }
            if(treeMenu.modelUrl1!=null&&treeMenu.modelUrl1!=""){
                var url = treeMenu.modelUrl1.split("|");
                if (judgeLink(url[0])) {
                    control3_1.getChild('c3_1').set('content','<iframe src=' + url[0] + ' height="100%" width="100%" scrolling='+ url[1]+'></iframe>');
                } else if (judgeImg(url[0])) {
                    control3_1.getChild('c3_1').set('content','<img src='+url[0]+' height="100%" width="100%">');
                }
            }
            if(treeMenu.title2!=null&&treeMenu.title2!=""){
                $('#title2').html(treeMenu.title2);
            }
            if(treeMenu.modelUrl2!=null&&treeMenu.modelUrl2!=""){
                var url = treeMenu.modelUrl2.split("|");
                $('#iframe1').attr('src',url[0]);
                $('#iframe1').attr('scrolling',url[1]);
            }
            if(treeMenu.title3!=null&&treeMenu.title3!=""){
                $('#title3').html(treeMenu.title3);
            }
            if(treeMenu.modelUrl3!=null&&treeMenu.modelUrl3!=""){
                var url = treeMenu.modelUrl3.split("|");
                $('#iframe2').attr('src',url[0]);
                $('#iframe2').attr('scrolling',url[1]);
            }
        }
        $('.x-border-title').css('padding','3px');
        $('.ext-border-layout').css('padding','0px');
    }
</script>
</body>
</html>